package com.boby.homecamera.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView

class BottomSpaceDecoration(private val bottomSpace: Int) : RecyclerView.ItemDecoration() {
    override fun getItemOffsets(
        outRect: android.graphics.Rect,
        view: View,
        parent: RecyclerView,
        state: RecyclerView.State
    ) {
        val position = parent.getChildAdapterPosition(view)
        if(position == 0){
            outRect.top = bottomSpace
        }else{
            outRect.top = 0
        }
        if (position == parent.adapter!!.itemCount - 1) {
            outRect.bottom = bottomSpace * 3
        }else{
            outRect.bottom = 0
        }
    }
}